In [1]:
%pylab inline


Populating the interactive namespace from numpy and matplotlib

Creating a mock catalogue with Galaxia Galaxia needs an input parameter file which I have prepared in the input folder. It will sample 10% of the stars with an apparent V magnitude brighter than 11th mag (without extinction). Have a look at the file and compare with the Galaxia instructions [http://galaxia.sourceforge.net/Galaxia3pub.html].


In [2]:
import subprocess, os, shutil, ebf, sys
from numpy.lib.recfunctions import append_fields
from astropy.io import fits
## Running galaxia in the command line. This will take some time (ca. 10min).
# Now we want to convert the ebf file to numpy files
path = os.path.abspath('../library/')
if path not in sys.path:
    sys.path.append(path)

from convert_to_recarray import convert

In [3]:
# Here we create the folder where Galaxia will write the mock catalogue
nside = 16 # for extinction map and mollweide plot

################### All strings and float except for
outputFile = "GDR2mock_20.7Gmag"
modelFile = "Model/population_parameters_mrtd5.ebf"
codeDataDir = "/home/rybizki/Programme/GalaxiaData"
outputDir = '../output/mock_cat_new'
photoSys = "parsec1/GAIADR2_TMASS"
magcolorNames = "gaia_g,gaia_gbp-gaia_grp"
appMagLimits0 = -1000 
appMagLimits1 = 20.7
absMagLimits0 = -1000
absMagLimits1 = 1000
colorLimits0 = -1000
colorLimits1 = 1000
geometryOption = 0 #int
longitude = 0
latitude = 90
surveyArea = 1000
fSample = 0.0001
popID = -1 #int
warpFlareOn = 1 #int
seed = 1 #int
r_max = 1000
starType = 0 #int
photoError = 0 #int

folder_create = outputDir + '/'
if os.path.exists(folder_create):
    shutil.rmtree(folder_create)
    os.mkdir(folder_create)
    print(folder_create, "existed and was recreated")
else:
    os.mkdir(folder_create)
###################
# Creating the parameterfile
filedata = 'outputFile                          %s\nmodelFile                          %s\ncodeDataDir                          %s\noutputDir                           %s\nphotoSys                            %s\nmagcolorNames                       %s\nappMagLimits[0]                     %f\nappMagLimits[1]                     %f\nabsMagLimits[0]                     %f\nabsMagLimits[1]                     %f\ncolorLimits[0]                      %f\ncolorLimits[1]                      %f\ngeometryOption                      %d\nlongitude                           %f\nlatitude                            %f\nsurveyArea                          %f\nfSample                             %f\npopID                               %d\nwarpFlareOn                         %d\nseed                                %d\nr_max                               %f\nstarType                            %d\nphotoError                          %d\n' %(outputFile,modelFile,codeDataDir,outputDir,photoSys,magcolorNames,appMagLimits0,appMagLimits1,absMagLimits0,absMagLimits1,colorLimits0,colorLimits1,geometryOption,longitude,latitude,surveyArea,fSample,popID,warpFlareOn,seed,r_max,starType,photoError)
myparameterfile = outputDir + '/' + outputFile + '.log'
file = open(myparameterfile, "w")
file.write(filedata)
file.close()

In [4]:
# Creating mock catalogue
args = ['galaxia', '-r', myparameterfile]
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)	
print("Galaxia spawns catalogue")
(output, err) = p.communicate()
#p_status = p.wait()
print(output)


Galaxia spawns catalogue
b'Galaxia-v0.81\nCODEDATAPATH=/home/rybizki/Programme/GalaxiaData/\nReading Parameter file-             ../output/mock_cat_new/GDR2mock_20.7Gmag.log\n--------------------------------------------------------\noutputFile               GDR2mock_20.7Gmag       \nmodelFile                Model/population_parameters_mrtd5.ebf\ncodeDataDir              /home/rybizki/Programme/GalaxiaData\noutputDir                ../output/mock_cat_new  \nphotoSys                 parsec1/GAIADR2_TMASS   \nmagcolorNames            gaia_g,gaia_gbp-gaia_grp\nappMagLimits[0]          -1000.000000            \nappMagLimits[1]          20.700000               \nabsMagLimits[0]          -1000.000000            \nabsMagLimits[1]          1000.000000             \ncolorLimits[0]           -1000.000000            \ncolorLimits[1]           1000.000000             \ngeometryOption           0                       \nlongitude                0.000000                \nlatitude                 90.000000               \nsurveyArea               1000.000000             \nfSample                  0.000100                \npopID                    -1                      \nwarpFlareOn              1                       \nseed                     1                       \nr_max                    1000.000000             \nstarType                 0                       \nphotoError               0                       \n--------------------------------------------------------\nReading tabulated values from file- /home/rybizki/Programme/GalaxiaData/Model/vcirc.dat\nUsing geometry:                     All Sky\nReading Isochrones from dir-        /home/rybizki/Programme/GalaxiaData/Isochrones/padova/parsec1/GAIADR2_TMASS\nzsol=0.0152\n/home/rybizki/Programme/GalaxiaData/Isochrones/padova/parsec1/GAIADR2_TMASS\n17877 101 177\nIsochrone Grid Size:                (Age bins=177,Feh bins=101,Alpha bins=1)\nTime Isocrhone Reading              1.25538     \nGenerating populations................\n--------------------------------------------------------\nThin disc sigma_v=[50, 32.3, 21, 0.33, 0.33]\n    [feh, dfeh]=[0.01, 0], [0.12, 0.2]\nThin Disk,ID=0:\nReading tree from file-             /home/rybizki/Programme/GalaxiaData/BHTree-2.3/bhtree_with_wf/bhtree_0_E1.ebf\nTime Tree generation/reading =      1.3784      \nCompleted % <0..10..20..30..40..50..60..70..80..90..>\nStars spawned =                     9323        \nTime Spawning=                      72.3923     \n--------------------------------------------------------\nThin disc sigma_v=[50, 32.3, 21, 0.33, 0.33]\n    [feh, dfeh]=[0.01, 0], [0.12, 0.2]\nThin Disk,ID=1:\nReading tree from file-             /home/rybizki/Programme/GalaxiaData/BHTree-2.3/bhtree_with_wf/bhtree_1_E1.ebf\nTime Tree generation/reading =      0.876796    \nCompleted % <0..9..19..29..39..49..59..69..79..89..99..>\nStars spawned =                     47656       \nTime Spawning=                      40.7916     \n--------------------------------------------------------\nThin disc sigma_v=[50, 32.3, 21, 0.33, 0.33]\n    [feh, dfeh]=[0.01, 0], [0.12, 0.2]\nThin Disk,ID=2:\nReading tree from file-             /home/rybizki/Programme/GalaxiaData/BHTree-2.3/bhtree_with_wf/bhtree_2_E1.ebf\nTime Tree generation/reading =      1.0921      \nCompleted % <0..9..19..29..39..49..59..69..79..89..99..>\nStars spawned =                     51270       \nTime Spawning=                      32.6741     \n--------------------------------------------------------\nThin disc sigma_v=[50, 32.3, 21, 0.33, 0.33]\n    [feh, dfeh]=[0.01, 0], [0.12, 0.2]\nThin Disk,ID=3:\nReading tree from file-             /home/rybizki/Programme/GalaxiaData/BHTree-2.3/bhtree_with_wf/bhtree_3_E1.ebf\nTime Tree generation/reading =      0.986306    \nCompleted % <0..9..19..29..39..49..59..69..79..89..99..>\nStars spawned =                     46475       \nTime Spawning=                      26.7434     \n--------------------------------------------------------\nThin disc sigma_v=[50, 32.3, 21, 0.33, 0.33]\n    [feh, dfeh]=[0.01, 0], [0.12, 0.2]\nThin Disk,ID=4:\nReading tree from file-             /home/rybizki/Programme/GalaxiaData/BHTree-2.3/bhtree_with_wf/bhtree_4_E1.ebf\nTime Tree generation/reading =      1.06469     \nCompleted % <0..9..19..29..39..49..59..69..79..89..99..>\nStars spawned =                     82421       \nTime Spawning=                      33.4142     \n--------------------------------------------------------\nThin disc sigma_v=[50, 32.3, 21, 0.33, 0.33]\n    [feh, dfeh]=[0.01, 0], [0.12, 0.2]\nThin Disk,ID=5:\nReading tree from file-             /home/rybizki/Programme/GalaxiaData/BHTree-2.3/bhtree_with_wf/bhtree_5_E1.ebf\nTime Tree generation/reading =      0.817695    \nCompleted % <0..9..19..29..39..49..59..69..79..89..99..>\nStars spawned =                     71390       \nTime Spawning=                      23.9853     \n--------------------------------------------------------\nThin disc sigma_v=[50, 32.3, 21, 0.33, 0.33]\n    [feh, dfeh]=[0.01, 0], [0.12, 0.2]\nThin Disk,ID=6:\nReading tree from file-             /home/rybizki/Programme/GalaxiaData/BHTree-2.3/bhtree_with_wf/bhtree_6_E1.ebf\nTime Tree generation/reading =      0.921536    \nCompleted % <0..9..19..29..39..49..59..69..79..89..99..>\nStars spawned =                     74234       \nTime Spawning=                      30.4281     \n--------------------------------------------------------\nfeh=-0.17 sig_feh=0.27\nThick disc sigma_v=[67, 51, 42, 0.33, 0.33]\n    [feh, dfeh, age, dage]=[-0.162, 0.17, 1e+10, 1e+09]\nThickDisk:\nReading tree from file-             /home/rybizki/Programme/GalaxiaData/BHTree-2.3/bhtree_with_wf/bhtree_7_E0.ebf\nTime Tree generation/reading =      0.069138    \nCompleted % <0..9..19..29..39..49..59..69..79..89..99..>\nStars spawned =                     110720      \nTime Spawning=                      3.42992     \n--------------------------------------------------------\nSpheroid sigma_v=[135, 85, 85]\n    [feh, dfeh, age, dage]=[-1.78, 0.5, 1.3e+10, 0]\nSpheroid:\nReading tree from file-             /home/rybizki/Programme/GalaxiaData/BHTree-2.3/bhtree_with_wf/bhtree_8_E0.ebf\nTime Tree generation/reading =      0.062496    \nCompleted % <0..9..19..29..39..49..59..69..79..89..99..>\nStars spawned =                     5796        \nTime Spawning=                      4.75874     \n--------------------------------------------------------\nBulge sigma_v=[110, 110, 100, 71.62]\n    [feh, dfeh, age, dage]=[0, 0.4, 1e+10, 0]\nBulge:\nReading tree from file-             /home/rybizki/Programme/GalaxiaData/BHTree-2.3/bhtree_with_wf/bhtree_9_E0.ebf\nTime Tree generation/reading =      0.927876    \nCompleted % <0..9..19..29..39..49..59..69..79..89..99..>\nStars spawned =                     112276      \nTime Spawning=                      51.7121     \n--------------------------------------------------------\nTotal stars written                 611561                  \nFile written-                       ../output/mock_cat_new//GDR2mock_20.7Gmag.ebf\nCalulating magnitudes................\nReading Isochrones from dir-        /home/rybizki/Programme/GalaxiaData/Isochrones/padova/parsec1/GAIADR2_TMASS\nzsol=0.0152\n/home/rybizki/Programme/GalaxiaData/Isochrones/padova/parsec1/GAIADR2_TMASS\n17877 101 177\nIsochrone Grid Size:                (Age bins=177,Feh bins=101,Alpha bins=1)\nTime Isocrhone Reading              1.75218     \ngaia_g\ngaia_gbp\ngaia_grp\ntmass_j\ntmass_h\ntmass_ks\nlabel\nCalulating Extinction................\nTime for extinction calculation     0.567354    \nTotal Time=                         332.623     \n'

You can add other photometric systems using

galaxia -a --psys=photometricSystem galaxy1.ebf

for photometric system you can use SDSS, UBV or Gaia which are in the Galaxia isochrones folder. You can get updated photometric bands from PARSEC isochrones compiled from [http://stev.oapd.inaf.it/cgi-bin/cmd] here [https://keeper.mpdl.mpg.de/d/4d6cb73b17524416ba43/]. Simply copy paste them into the respective Galaxia folder.


In [5]:
"""
# Adding other photometric bands
args = ['galaxia', '-a', '--psys=Gaia' ,'../output/' + filename]
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)	
print("Galaxia adds Gaia bands")
(output, err) = p.communicate()
#p_status = p.wait()
print(output)
"""


Out[5]:
'\n# Adding other photometric bands\nargs = [\'galaxia\', \'-a\', \'--psys=Gaia\' ,\'../output/\' + filename]\np = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\t\nprint("Galaxia adds Gaia bands")\n(output, err) = p.communicate()\n#p_status = p.wait()\nprint(output)\n'

In [6]:
# Reading in the Catalogue and converting it to npy file. (If you added photometric bands then you will have to edit the convert routine)
bes = ebf.read(outputDir + "/" + outputFile + ".ebf",'/')
x = convert(bes)
print(len(x))
print(x.dtype.names)


611561
('rad', 'teff', 'vx', 'vy', 'vz', 'pz', 'px', 'py', 'feh', 'exbv_schlegel', 'lum', 'glon', 'glat', 'alpha', 'smass', 'age', 'grav', 'gaia_g', 'gaia_gbp', 'gaia_grp', 'tmass_j', 'tmass_h', 'tmass_ks')

In [7]:
# We add ra and dec

from astropy.coordinates import SkyCoord
from astropy import units as u


x = append_fields(x,('ra','dec'),(np.zeros(len(x)),np.zeros(len(x))),usemask=False)
c = SkyCoord(b=x['glat'], l=x['glon'], frame = 'galactic', unit=(u.deg, u.deg))
x['ra'] = c.icrs.ra.deg
x['dec'] = c.icrs.dec.deg

In [8]:
## Turning absolute into apparent magnitudes

filternames = ['tmass_j','tmass_h','tmass_ks','gaia_g','gaia_gbp','gaia_grp']	
for band in filternames:
    x[band] += 5 * np.log10(x['rad']*1000.) - 5

In [9]:
## Optional you can use extinctions from Bovy 2016 python package mwdust (using Green2015, Marshall2006 and Schlegel)
from make_bovy_extinction import apply_bovy_extinction
x = apply_bovy_extinction(x,nside)


/home/rybizki/anaconda3/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
  return f(*args, **kwds)

/home/rybizki/anaconda3/lib/python3.6/site-packages/h5py/__init__.py:34: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters

611561
0 3028
1000 3028
2000 3028
3000 3028
1.604776157448807

In [10]:
# Adding extinctions on top

## Adding extinction to apparent magnitudes
## Gaia extinction
gaia_g_ext = x['exbv_schlegel'] * 2.3# just guessed
x['gaia_g'] += gaia_g_ext
gaia_g_bp_ext = x['exbv_schlegel'] * 2.8 # from Jordi+ 2010 and Schlafly + Finkbeiner 2011 closest effective wavelength
x['gaia_gbp'] += gaia_g_bp_ext 
gaia_g_rp_ext = x['exbv_schlegel'] * 1.52 # from Jordi+ 2010 and Schlafly + Finkbeiner 2011 closest effective wavelength
x['gaia_grp'] += gaia_g_rp_ext

## Other bands
filternames = ['tmass_j','tmass_h','tmass_ks']#,'gaia_g','gaia_g_bp','gaia_g_rp']	
extinction_coefficients = [0.709, 0.449, 0.302] #List from Schlafly & Finkbeiner 2011
for i,band in enumerate(filternames):
    x[band] += x['exbv_schlegel'] * extinction_coefficients[i]

In [11]:
# Now create a mag limited sample roughly half of the sample will be lost due to extinction
print(len(x))
cut = (x['gaia_g']<appMagLimits1)
x = x[cut]
print(len(x))


611561
145036

In [12]:
np.save(outputDir + "/" + outputFile,x)
fits.writeto(outputDir + "/" + outputFile + ".fits",x)

In [13]:
### Plot the stellar density across the sky
## Using plotting routines from Tri Astraatmadja
import healpy as hp
import matplotlib.cm as cm
from matplotlib.colors import LogNorm
import matplotlib
from defaults import getLogTickMarks


x = np.load(outputDir + "/" + outputFile + '.npy')
NSIDE = nside
oversampling = 1./fSample
total = len(x)
x['glon'] = x['glon'] * (np.pi/180.)
x['glat'] = (90.-x['glat']) * (np.pi/180.)
print('total number of stars = %.d' %(total * oversampling))
count = hp.ang2pix(NSIDE,x['glat'],x['glon'])
sqdegs = 41253
pixels = NSIDE * NSIDE * 12
pixel_per_sqdeg = pixels / float(sqdegs)
min_density = oversampling * pixel_per_sqdeg 
m = np.arange(hp.nside2npix(NSIDE))
density = np.zeros(hp.nside2npix(NSIDE))
for item in count:
    density[item] += oversampling * pixel_per_sqdeg
print(np.min(density))
print(sum(density)/pixel_per_sqdeg)
print(sum(density))
cmap = cm.jet
cmap.set_under(cmap(0.0))
cmap.set_over(cmap(1.0))
norm=LogNorm()
minVal = np.nanmin(density[density>0])
maxVal = np.nanmax(density[density<+np.inf])
density[density<minVal] = minVal
x['glon'] = x['glon'] * (180./np.pi)
cbLabel=r'$n_{\rm stars}$ [sq.deg$^{-1}$]'
hp.mollview(density, unit=cbLabel, min=minVal, max=maxVal, nest=False, title='', norm=norm, cmap=cmap, cbar=None)
fig = plt.gcf()
ax = plt.gca()
pos1 = ax.get_position() # get the original position 
pos2 = [pos1.x0, pos1.y0 + 0.06,  pos1.width, pos1.height]
ax.set_position(pos2) # set a new position
im = ax.get_images()[0]
cbAx = fig.add_axes([0.1, 0.12, 0.8, 0.03])
cb = plt.colorbar(im, cax=cbAx, orientation='horizontal', )
cb.ax.minorticks_on()
tickMarks = getLogTickMarks(minVal, maxVal)
minorticks = im.norm(tickMarks)
cb.ax.xaxis.set_ticks(minorticks, minor=True)
cb.solids.set_edgecolor("face")
cb.set_label(cbLabel)
plt.title(r"%.1fm stars with m$_\mathrm{G}$<%fmag" %(total*oversampling/1e6,appMagLimits1), fontsize = 12)
plt.show()


/home/rybizki/Desktop/Galaxia_wrap-master/library/defaults.py:9: UserWarning: 
This call to matplotlib.use() has no effect because the backend has already
been chosen; matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.

The backend was *originally* set to 'module://ipykernel.pylab.backend_inline' by the following code:
  File "/home/rybizki/anaconda3/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/rybizki/anaconda3/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/rybizki/anaconda3/lib/python3.6/site-packages/ipykernel_launcher.py", line 16, in <module>
    app.launch_new_instance()
  File "/home/rybizki/anaconda3/lib/python3.6/site-packages/traitlets/config/application.py", line 658, in launch_instance
    app.start()
  File "/home/rybizki/anaconda3/lib/python3.6/site-packages/ipykernel/kernelapp.py", line 477, in start
    ioloop.IOLoop.instance().start()
  File "/home/rybizki/anaconda3/lib/python3.6/site-packages/zmq/eventloop/ioloop.py", line 177, in start
    super(ZMQIOLoop, self).start()
  File "/home/rybizki/anaconda3/lib/python3.6/site-packages/tornado/ioloop.py", line 888, in start
    handler_func(fd_obj, events)
  File "/home/rybizki/anaconda3/lib/python3.6/site-packages/tornado/stack_context.py", line 277, in null_wrapper
    return fn(*args, **kwargs)
  File "/home/rybizki/anaconda3/lib/python3.6/site-packages/zmq/eventloop/zmqstream.py", line 440, in _handle_events
    self._handle_recv()
  File "/home/rybizki/anaconda3/lib/python3.6/site-packages/zmq/eventloop/zmqstream.py", line 472, in _handle_recv
    self._run_callback(callback, msg)
  File "/home/rybizki/anaconda3/lib/python3.6/site-packages/zmq/eventloop/zmqstream.py", line 414, in _run_callback
    callback(*args, **kwargs)
  File "/home/rybizki/anaconda3/lib/python3.6/site-packages/tornado/stack_context.py", line 277, in null_wrapper
    return fn(*args, **kwargs)
  File "/home/rybizki/anaconda3/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 283, in dispatcher
    return self.dispatch_shell(stream, msg)
  File "/home/rybizki/anaconda3/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 235, in dispatch_shell
    handler(stream, idents, msg)
  File "/home/rybizki/anaconda3/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 399, in execute_request
    user_expressions, allow_stdin)
  File "/home/rybizki/anaconda3/lib/python3.6/site-packages/ipykernel/ipkernel.py", line 196, in do_execute
    res = shell.run_cell(code, store_history=store_history, silent=silent)
  File "/home/rybizki/anaconda3/lib/python3.6/site-packages/ipykernel/zmqshell.py", line 533, in run_cell
    return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
  File "/home/rybizki/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2698, in run_cell
    interactivity=interactivity, compiler=compiler, result=result)
  File "/home/rybizki/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2808, in run_ast_nodes
    if self.run_code(code, result):
  File "/home/rybizki/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2862, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-1-d4543581fa9d>", line 1, in <module>
    get_ipython().magic('pylab inline')
  File "/home/rybizki/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2146, in magic
    return self.run_line_magic(magic_name, magic_arg_s)
  File "/home/rybizki/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2067, in run_line_magic
    result = fn(*args,**kwargs)
  File "<decorator-gen-108>", line 2, in pylab
  File "/home/rybizki/anaconda3/lib/python3.6/site-packages/IPython/core/magic.py", line 187, in <lambda>
    call = lambda f, *a, **k: f(*a, **k)
  File "/home/rybizki/anaconda3/lib/python3.6/site-packages/IPython/core/magics/pylab.py", line 155, in pylab
    gui, backend, clobbered = self.shell.enable_pylab(args.gui, import_all=import_all)
  File "/home/rybizki/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2969, in enable_pylab
    gui, backend = self.enable_matplotlib(gui)
  File "/home/rybizki/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2930, in enable_matplotlib
    pt.activate_matplotlib(backend)
  File "/home/rybizki/anaconda3/lib/python3.6/site-packages/IPython/core/pylabtools.py", line 307, in activate_matplotlib
    matplotlib.pyplot.switch_backend(backend)
  File "/home/rybizki/anaconda3/lib/python3.6/site-packages/matplotlib/pyplot.py", line 231, in switch_backend
    matplotlib.use(newbackend, warn=False, force=True)
  File "/home/rybizki/anaconda3/lib/python3.6/site-packages/matplotlib/__init__.py", line 1422, in use
    reload(sys.modules['matplotlib.backends'])
  File "/home/rybizki/anaconda3/lib/python3.6/importlib/__init__.py", line 166, in reload
    _bootstrap._exec(spec, module)
  File "/home/rybizki/anaconda3/lib/python3.6/site-packages/matplotlib/backends/__init__.py", line 16, in <module>
    line for line in traceback.format_stack()


  matplotlib.use('Agg') ## use a non-interactive Agg background

total number of stars = 1450360000
0.0
1450359999.9999938
108004409.86110055

In [ ]: